/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.nattakute.model;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

import java.io.Serializable;
import java.util.Set;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.codehaus.jackson.annotate.JsonManagedReference;

/**
 *
 * @author simple7211
 */
@Entity
@Table(name = "classes")

public class Classes implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "classID")
    private Integer classId;
    
    @Basic(optional = false)
    @Column(name = "className")
    private String className;
    
    @Basic(optional = false)
    @Column(name = "amountTime")
    private float amountTime;
    
    @JsonManagedReference
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "classs", fetch = FetchType.LAZY)
    private Set<Timetable> timetables;

    public Classes() {
    }

    public Classes(Integer classId) {
        this.classId = classId;
    }

    public Classes(Integer classId, String className, float amountTime) {
        this.classId = classId;
        this.className = className;
        this.amountTime = amountTime;
    }

    

    public Integer getClassId() {
		return classId;
	}

	public void setClassId(Integer classId) {
		this.classId = classId;
	}

	public String getClassName() {
        return className;
    }

    public void setClassName(String className) {
        this.className = className;
    }

    public float getAmountTime() {
        return amountTime;
    }

    public void setAmountTime(float amountTime) {
        this.amountTime = amountTime;
    }

    
    

    public Set<Timetable> getTimetables() {
		return timetables;
	}

	public void setTimetables(Set<Timetable> timetables) {
		this.timetables = timetables;
	}

	@Override
    public int hashCode() {
        int hash = 0;
        hash += (classId != null ? classId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Classes)) {
            return false;
        }
        Classes other = (Classes) object;
        if ((this.classId == null && other.classId != null) || (this.classId != null && !this.classId.equals(other.classId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "javaapplication1.Classes[ classID=" + classId + " ]";
    }
    
}

